<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>改变盒子大小</title>
		<style>
			#box{
				width: 50px;
				height: 50px;
				margin: 0 auto;
				background: yellowgreen;
			}
		
		</style>
	</head>
	<body>
		<div id="box">小</div>
		
		<script>
			var box=document.getElementById("box");
			var a=0;
			box.onclick=function(){
				a++;
				if(a%2==0){
					//改变内容
					box.innerHTML="小";
					//改变样式
					box.style.width='50px';
					box.style.height='50px';
				}else
				{
					box.innerHTML='大';
					box.style.width='150px';
					box.style.height='150px';
				}
			};
		</script>
	</body>
</html>
